extends Node

# 当前关卡
var current_level = 1
# 最大关卡数
var max_level = 3

# 关卡配置
var level_configs = {
	1: {
		"spawn_interval": 1.0,
		"enemy_config": {
			"normal": 0.7,  # 普通敌人生成概率
			"fast": 0.2,   # 快速敌人生成概率
			"shooter": 0.1 # 射手敌人生成概率
		},
		"boss_config": {
			"spawn_time": 30.0,  # Boss生成时间（秒）
			"scene": preload("res://Scenes/EnemyBoss1.tscn")  # Boss场景
		},
		"background": preload("res://asset/png/战斗背景.png"),  # 背景图片
		"completion_score": 5000  # 完成关卡所需分数
	},
	2: {
		"spawn_interval": 0.8,
		"enemy_config": {
			"normal": 0.5,
			"fast": 0.3,
			"shooter": 0.2
		},
		"boss_config": {
			"spawn_time": 25.0,
			"scene": preload("res://Scenes/EnemyBoss1.tscn")
		},
		"background": preload("res://asset/png/战斗背景2.png"),
		"completion_score": 15000
	},
	3: {
		"spawn_interval": 0.5,
		"enemy_config": {
			"normal": 0.3,
			"fast": 0.4,
			"shooter": 0.3
		},
		"boss_config": {
			"spawn_time": 20.0,
			"scene": preload("res://Scenes/EnemyBoss2.tscn")
		},
		"background": preload("res://asset/png/战斗背景3.png"),
		"completion_score": 30000
	}
}

func _ready():
	# 初始化关卡
	pass

# 获取当前关卡的敌人生成间隔
func get_current_spawn_interval() -> float:
	return level_configs[current_level]["spawn_interval"]

# 获取当前关卡的敌人配置
func get_current_enemy_config() -> Dictionary:
	return level_configs[current_level]["enemy_config"]

# 获取当前关卡的Boss配置
func get_current_boss_config() -> Dictionary:
	return level_configs[current_level]["boss_config"]

# 获取当前关卡的背景
func get_current_background():
	return level_configs[current_level]["background"]

# 检查关卡是否完成
func check_level_completion(current_score: int) -> bool:
	var completion_score = level_configs[current_level]["completion_score"]
	return current_score >= completion_score

# 进入下一关
func next_level() -> bool:
	if current_level < max_level:
		current_level += 1
		return true
	else:
		# 已经是最后一关
		return false